<template>
  <div>
    <!-- 显示 -->
    <div class="btn-group" v-for="(group, indexgroup) of this.btns" :key=indexgroup>
      <button type="button" v-for="(btn, keybtn) of group" :key=keybtn :class=btn.class :value=keybtn @click=onbtn($event)>{{btn.text}}</button>
    </div>
  </div>
</template>

<script>
/* eslint-disable comma-dangle */
export default {
  data: function () {
    return {
      vdata: this.gdata.data,
      btns: [
        {
          'game': { text: '综合', class: 'btn btn-primary btn-sm' },
          'chat': { text: '聊天', class: 'btn btn-primary btn-sm' },
          'offline': { text: '挂机', class: 'btn btn-primary btn-sm' }
        },
        {
          'set': { text: '设置', class: 'btn btn-warning btn-sm' },
          'help': { text: '帮助', class: 'btn btn-warning btn-sm' },
          'test': { text: '测试功能', class: 'btn btn-dark btn-sm' },
          'debug': { text: '调试信息', class: 'btn btn-warning btn-sm' }
        },
        {
          'score': { text: '属性和状态', class: 'btn btn-info btn-sm' },
          'skills': { text: '技能和技法', class: 'btn btn-info btn-sm' }
        },
        {
          'fly': { text: '飞行', class: 'btn btn-success btn-sm' },
          'inv': { text: '背包', class: 'btn btn-success btn-sm' },
          'map': { text: '地图', class: 'btn btn-success btn-sm' },
          'top': { text: '排行榜', class: 'btn btn-success btn-sm' },
          'shop': { text: '商会', class: 'btn btn-success btn-sm' }
        }
      ]
    }
  },
  components: {
    // websocket: websocket
  },
  methods: {
    ontest: function () {
      var text = 'dsadasdsadas'
      for (var i = 0; i < 10; i++) {
        this.jxdebug(text)
        this.jxwdtext(text)
      }
      this.jxwdtextmud('哈哈哈哈')
      this.jxwdtextmud('#YEL#哈#HIG#哈#HIR#哈#HIC#哈')
      this.jxwdtextmud('哈#HIG#哈#HIR#哈#HIC#哈')
      this.jxwdtextmud('#DeepSkyBlue#哈##32CD32#哈#HIR#哈#HIC#哈')
    },
    onpage: function (page) {
      this.jxpage(page)
    },
    onmodfunc: function (mod) {
      this.jxmodfunc(mod)
    },
    onmodinfo: function (mod) {
      this.jxmodinfo(mod)
    },
    onbtn: function (event) {
      var btn = event.srcElement.value
      switch (btn) {
        case 'game':
          this.onpage(btn)
          this.$parent.$refs.game.$refs.window.scrollbottom()
          break
        case 'debug':
          this.onmodfunc(btn)
          break
        case 'fly':
        case 'chat':
          this.onmodfunc(btn)
          break
        case 'test':
          this.ontest()
          break
        case 'score':
          this.wssend(this.wsreq('C2G_CHAR_SCORE'))
          break
        case 'skills':
          this.wssend(this.wsreq('C2G_SKILL_LIST'))
          break
        case 'offline':
          this.wssend(this.wsreq('C2G_CHAR_OFFLINEINFO'))
          break
        case 'inv':
          this.wssend(this.wsreq('C2G_CHAR_INV'))
          break
        default:
          // 这里是没有找到对应的值处理
          break
      }
    }
  }
}
</script>

<style scoped>
</style>
